<?php 


/** 
***************************************************
*欢迎使用免费版xSite企业自助建站软件！
*这是一个专业为搜索引擎营销而设计的，极稳定、极易维护的建站软件！
*官方客服：help@php.net.cn
*官方下载网址：http://www.php.net.cn/xsite/ 
***************************************************
**/




if(!defined('IN_SITETEAM')) { exit('Access Denied'); } $page = empty($_GET['page']) ? empty($_POST['page']) ? 1 : $_POST['page'] : $_GET['page']; $keywords = strip_tags(empty($_GET['q']) ? empty($_POST['q']) ? '' : $_POST['q'] : $_GET['q']); if (empty($keywords)) { header("Location: http://{$site_url}{$site_path}/m/"); } $data = array(); $json = array(); $article_list = tpl_article_search("keywords={$keywords}&limit=9&page={$page}"); $article_list = $article_list['list']; $product_list = tpl_product_search("keywords={$keywords}&limit=9&&page={$page}"); $product_list = $product_list['list']; if (is_array($article_list) && count($article_list) ) { foreach ($article_list as $k => $v) { $v['module'] = 'article'; $data[$k] = $v; } } if (is_array($product_list) && count($product_list) ) { foreach ($product_list as $k => $v) { $v['module'] = 'product'; $data[$k] = $v; } } krsort($data, SORT_NUMERIC); foreach($data as $k => $v) { if ($v['module'] == 'article') { $temp = array(); $info = tpl_article_details("category={$v['category']}&key={$v['key']}"); $temp['t'] = @str_sub(_e($info['body_name'], '没有标题'), 40, '…'); $temp['i'] = $info['ptitle']; $temp['u'] = "category={$v['category']}&key={$v['key']}"; $temp['c'] = $v['category']; $temp['p'] = date("Y-m-d H:i", $v['key']); $temp['s'] = !empty($info['body_title']) ? $info['body_title'] : str_sub($info['content'], 150); $temp['id'] = $v['key']; $temp['k'] = $info['seo_keywords']; $json[] = $temp; } if ($v['module'] == 'product') { $temp = array(); $info = tpl_product_details("category={$v['category']}&key={$v['key']}"); $temp['t'] = @str_sub(_e($info['name'], '没有标题'), 40, '…'); $temp['i'] = $info['ptitle']; $temp['u'] = "category={$v['category']}&key={$v['key']}"; $temp['c'] = $v['category']; $temp['p'] = date("Y-m-d H:i", $v['key']); $temp['s'] = !empty($info['pname']) ? $info['pname'] : str_sub($info['content'], 120); $temp['id'] = $v['key']; $temp['k'] = $info['keywords']; $json[] = $temp; } } unset($data, $temp); ?>